/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package pgentity;

import db.DBContext;
import db.PGKeys;
import db.RedisKey;
import pgentity.redis.hash.DataHash;


/**
 *
 * @author KieuAnh
 */
public class UserTempData extends DataHash
{
    private final String uid;

    private UserTempData(String uid) {
        super(key(uid));
        this.uid = uid;
    }
    
    public static UserTempData getTempData(String uid)
    {
        UserTempData userTemp = new UserTempData(uid);
        return userTemp;
    }
    
    public static void destroy(String uid)
    {
        DBContext.Redis().del(key(uid));
    }
    
    public static RedisKey key(String uid)
    {
        return User.redisKey(uid).getChild(PGKeys.FD_TEMP_DATA);
    }
    
    public String getUid() {
        return uid;
    }
}